Adding a Backup Rule
If you want specific actions to perform before the backup starts or after the backup completes, you can set up a rule. For example, you may want a specific service stop before starting the backup. After the backup is completed, the service can automatically resume.
Before applying a rule along with a backup, add a backup rule first. Each rule can contain one or more subrules, and these subrules specify the actions, which are commands, to perform.
To back up specific applications, here are some examples of backup rules for your reference:
- Adding a Pre-backup Rule for Oracle DB
- Adding a Pre-backup Rule for PostgreSQL
- Adding Pre-backup/Post-backup Rules for MySQL
- Adding Pre-backup/Post-backup Rules for Microsoft SQL Server (HA)
After adding a rule, you can apply the rule along to a backup task. For more information about creating a backup task, see Backing up an Application, Backing up a Virtual Machine, and Backing up a Virtual Machine.
Procedure
- Go to EonOne for KS > Settings > Backup & restore > Backup rules.
- Click Add a rule.
- Go to the Add a rule page. Specify an identifying name for this rule.
- Go to the Subrule section, and specify the following information:
- Specify pods by label: Find pods by entering labels to filter them. Enter the key and value. For example, "app=mysql". If needed, you can add more to filter.
- (Optional) Container: If needed, specify the container name.
- Action: Specify the command. If needed, click + to add more actions.
- To specify more target pods and more actions need to be performed, click Add a subrule. Repeat step 3 to find the pods and specify the actions.
- Click OK.
Adding a Rule for Oracle DB
Before backing up the resources of Oracle DB, it is recommended that you add the following rule and apply it to be the pre-backup rule.
Note:
The rule can be applied to the version 1.0.6 and above.
Procedure
- Go to EonOne for KS > Settings > Backup & restore > Backup rules.
- Click Add a rule.
- Go to the Add a rule page. Specify an identifying name for this rule.
- Go to the Subrule section, and specify the following information:
- Specify pods by label: Enter the following label:
app=oracle-db-dep
- (Optional) Container: Enter the following container name:
kubectl.kubernetes.io/default-container=""
- Action: Enter the following commands:
#!/bin/bash set +e #Flush Shared pool means flushing the cached execution plan and SQL Queries from memory. #FLush buffer cache means flushing the cached data of objects from memory. echo "alter system flush buffer_cache;" | sqlplus / as sysdba echo "alter system flush shared_pool;" | sqlplus / as sysdba
- Specify pods by label: Enter the following label:
- Click OK.
Adding a Rule for PostgreSQL
Before backing up the resources of PostgreSQL, it is recommended that you add the following rule and apply it to be the pre-backup rule.
Note:
The rule can be applied to the version 1.0.2 and above.
Procedure
- Go to EonOne for KS > Settings > Backup & restore > Backup rules.
- Click Add a rule.
- Go to the Add a rule page. Specify an identifying name for this rule.
- Go to the Subrule section, and specify the following information:
- Specify pods by label: Enter the following label:
app=postgresql
- (Optional) Container: Enter the following container name:
kubectl.kubernetes.io/default-container=""
- Action: Enter the following commands:
PGPASSWORD=infortrend; psql -U infortrend -c "CHECKPOINT";
- Specify pods by label: Enter the following label:
- Click OK.
Adding a Rule for MySQL
Before backing up the resources of MySQL, it is recommended that you add the following rules and apply them to be the pre-backup and the post-backup rule.
Note:
These rules can be applied to the version 8.0.30 and above.
Procedure: Pre-backup
- Go to EonOne for KS > Settings > Backup & restore > Backup rules.
- Click Add a rule.
- Go to the Add a rule page. Specify an identifying name for this rule.
- Go to the Subrule section, and specify the following information:
- Specify pods by label: Enter the following label:
app=mysql
- (Optional) Container: Enter the following container name:
kubectl.kubernetes.io/default-container=""
- Action: Enter the following commands:
mysql -uroot -pmysql -Bse "FLUSH TABLES WITH READ LOCK;
- Specify pods by label: Enter the following label:
- Click OK.
Procedure: Post-backup
- Go to EonOne for KS > Settings > Backup & restore > Backup rules.
- Click Add a rule.
- Go to the Add a rule page. Specify an identifying name for this rule.
- Go to the Subrule section, and specify the following information:
- Specify pods by label: Enter the following label:
app=mysql
- (Optional) Container: Enter the following container name:
kubectl.kubernetes.io/default-container=""
- Action: Enter the following commands:
mysql -uroot -pmysql -Bse "FLUSH LOGS; UNLOCK TABLES;"
Note:
If you are using MySQL HA, execute the above action in the master (primary) pod.
- Specify pods by label: Enter the following label:
- Click OK.
Adding a Rule for Microsoft SQL Server (HA) Backup
Before backing up the resources of Microsoft SQL Server, it is recommended that you add the following rules and apply them to be the pre-backup and the post-backup rule.
Note:
These rules can be applied to the SQL server 2019 HA solution.
Procedure: Pre-backup
- Go to EonOne for KS > Settings > Backup & restore > Backup rules.
- Click Add a rule.
- Go to the Add a rule page. Specify an identifying name for this rule.
- Go to the Subrule section, and specify the following information:
- Specify pods by label: Enter the following label:
app=mssql
- (Optional) Container: Enter the following container name:
kubectl.kubernetes.io/default-container=""
- Action: Enter the following command:
ALTER DATABASE database_name SET HADR SUSPEND;
- Specify pods by label: Enter the following label:
- Click OK.
Procedure: Post-backup
- Go to EonOne for KS > Settings > Backup & restore > Backup rules.
- Click Add a rule.
- Go to the Add a rule page. Specify an identifying name for this rule.
- Go to the Subrule section, and specify the following information:
- Specify pods by label: Enter the following label:
app=mssql
- (Optional) Container: Enter the following container name:
kubectl.kubernetes.io/default-container=""
- Action: Enter the following command:
ALTER DATABASE database_name SET HADR RESUME;
Note:
If you are using MySQL HA, execute the above action in the master (primary) pod.
- Specify pods by label: Enter the following label:
- Click OK.
Managing a Backup Rule
You can edit/delete a rule, and view its configuration file.
Procedure
- Go to EonOne for KS > Settings > Backup & restore > Backup rules.
- To view rule information, find the desired rule entry in the list. Click Details.
- To edit a rule, select the desired rule entry in the list. Click Edit and change the settings. Click OK to save changes.
- To view the configuration file, select the desired rule entry in the list. Click View (JSON). View further details about this rule in JSON format. Click Close when you finish viewing.
- To delete a rule, select the desired rule entry in the list. Click Delete.